/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 87111
 * Date: 2025-05-24
 * Time: 15:23
 */
class Student {
    public String name = "张三";
    public int age = 18;
    public String sex = "男";
    //打印成员变量的方法：
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }

    //静态代码块
    static {

    }
    //实例代码块
    {
        name = "李四";
        age = 20;
    }
    public static void print() {
        System.out.println("hehe");
    }
}
public class Test1 {
    public static void main(String[] args) {
        Student student = new Student();
        System.out.println(student);
    }

    public static void main1(String[] args) {
        //方法一
        Student student = new Student();
        student.print();
        //方法二
        Student.print();
    }
}
